<?php get_header(); ?>
<?php get_sidebar(); ?>
<div class="main-content">
    <?php
    if(have_posts()) : while(have_posts()) : the_post(); ?>
    <div class="post <?php echo is_single() ? 'is-single' : '' ; ?>">
        <div class="post-inner-shadow"></div>
        <div class="post-content">
            <div class="content">
                <h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3>
				<span class="post-info"><?php the_time('F j, Y'); ?> | <a href="<?php comments_link(); ?>"><?php comments_number('Chưa có bình luận','1 bình luận','% bình luận'); ?></a></span>
				<?php if ( current_user_can('manage_options') || current_user_can('editor') ){
					$temp = echo_post_views(get_the_ID());
					echo '<br/><span class="post-info">Lượt người xem hôm nay : '.$temp[0] .'<br/> Lượt người xem trước đây : '. $temp[1].'</span>';
				}
				else{
					echo_post_views(get_the_ID());
				}
				?><div id="the-content">
				<?php the_content();?>
				</div>
            </div>
        </div>
    </div>
    <?php endwhile; ?>
    <?php else : ?>
        <p>sorry, no post to display</p>
    <?php endif; 
	wp_reset_query();
	?>
    
    <p class="more-products-title">Các sản phẩm khác:</p>
   	<div class="more-products">
    	<div class="more-products-inner-shadow"></div><!--end .more-products-inner-shadow-->
         <a href="#"><div class="more-products-nav-prev"></div></a>
        <div class="more-products-content">	
        	<ul>
            	 <?php 
				$relative_Products = new WP_query();
				$relative_Products->query("cat=3");
				if($relative_Products->have_posts()) : while($relative_Products->have_posts()) : $relative_Products->the_post();
				?>
            	<li>
                    <a href="<?php echo the_permalink(); ?>">
                        <?php
							if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
								thumb_img($post->ID,'80','160','100',get_the_title());
							}
							else {?>
							<img class="item-thumbs" src="<?php echo bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo bloginfo('stylesheet_directory'); ?>/images/no-thumbnail.png&h=80&w=160&zc=1&q=100" alt=""/>
						<?php } ?>  
                        <p><?php the_title(); ?></p>    
                    </a>
                </li>

                <?php endwhile; endif; 	wp_reset_query();?>
            </ul>
        </div><!--end .more-products-->
        <a href="#"><div class="more-products-nav-next"></div></a>
    </div><!--end .wapper-more-products-->

</div>
<div class="comment-template">
	<?php comments_template(); ?>
</div>
<?php get_footer(); ?>
